﻿using System;
using CoreRay.Collections;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CoreRay.Testing
{    
    /// <summary>
    /// This is a test class for BinaryTreeNodeTest and is intended
    /// to contain all BinaryTreeNodeTest Unit Tests.
    /// </summary>
    [TestClass]
    public class BinaryTreeNodeTest
    {
        /// <summary>
        /// Constructor test.
        /// </summary>
        [TestMethod]
        public void ConstructorTest()
        {
            // Setup
            GenericParameterHelper nodeData = new GenericParameterHelper();

            // Execute
            BinaryTreeNode<GenericParameterHelper> testNode = new BinaryTreeNode<GenericParameterHelper>(nodeData);

            // Verify
            Assert.AreEqual(nodeData, testNode.Data);
        }

        /// <summary>
        /// Constructor with children test.
        /// </summary>
        [TestMethod]
        public void ConstructorChildrenTest()
        {
            // Setup
            GenericParameterHelper nodeData = new GenericParameterHelper();
            BinaryTreeNode<GenericParameterHelper> leftNode = new BinaryTreeNode<GenericParameterHelper>(new GenericParameterHelper());
            BinaryTreeNode<GenericParameterHelper> rightNode = new BinaryTreeNode<GenericParameterHelper>(new GenericParameterHelper());

            // Execute
            BinaryTreeNode<GenericParameterHelper> testNode = new BinaryTreeNode<GenericParameterHelper>(nodeData, leftNode, rightNode);

            // Verify
            Assert.AreEqual(nodeData, testNode.Data);
            Assert.AreEqual(leftNode, testNode.LeftChild);
            Assert.AreEqual(rightNode, testNode.RightChild);
        }
    }
}
